﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenExpressApp.Types;

namespace OpenExpressApp
{
    public interface ICommandInfo : IViewInfo
    {
        CommandType CommandType { get; }
        Type TargetObjectType { get; }
        ModuleType ModuleType { get; }
        ViewType TargetViewType { get; }
        /// <summary>
        /// 这个命令显示在哪个类型的工具条上
        /// </summary>
        ToolbarType ToolbarType { get; }
        /// <summary>
        /// 命令的类别
        /// </summary>
        CommandCategory Category { get; }
        /// <summary>
        /// 分组名
        /// </summary>
        string Group { get; }
        /// <summary>
        /// 如果使用空构造函数，则Name为null，
        /// 不再唯一，若想获取唯一标记，请调用方法GetUniqueName
        /// </summary>
        string Name { get; }
    }
    public interface ICommand
    {
        ICommandInfo Info { get; }

        /// <summary>
        /// 是否需要显示这个命令所对应的按钮
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool CanVisible(object param);
        /// <summary>
        /// 是否这个命令所对应的按钮可以被执行
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        bool CanExecute(object param);
        /// <summary>
        /// 执行这个命令
        /// </summary>
        /// <param name="param"></param>
        void Execute(object param);
    }
}